﻿<html xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>添加菜单</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <div th:include="layout/resources :: resources"></div>
</head>
<body>
<div class="container">
    <form method="post">
        <input type="hidden" id="level" name="level" value="0">
        <div class="form-group">
            <label for="text">菜单名称</label>
            <input type="text" class="form-control" id="text" name="text">
        </div>
        <div class="form-group">
            <label for="Icon">Icon</label>
            <input type="text" class="form-control" id="Icon" name="Icon">
        </div>
        <div class="form-group">
            <label for="targetType">TargetType</label>
            <select class="form-control" id="targetType">
                <option value="iframe-tab">iframe-tab</option>
                <option value="blank">blank</option>
            </select>
        </div>
        <div class="form-group">
            <label for="url">地址</label>
            <input type="text" class="form-control" id="url" name="url">
        </div>
        <div class="form-group">
            <label for="isOpen">是否展开</label>
            <select class="form-control" id="isOpen">
                <option value="false">否</option>
                <option value="true">是</option>
            </select>
        </div>
        <button type="button" onclick="add();" class="btn btn-default">保存</button>
    </form>
</div>
<script>
    function add() {
        $.ajax({
            method: "post",
            url: createUrl("/menu/add"),
            data: $("form").serialize(),
            success: function (result) {
                if (result.errorCode == 0) {
                    framework.successMsg("添加成功");
                } else {
                    framework.errorMsg("添加失败");
                }
            }
        })
    }
</script>
</body>
</html>
